aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/invoice/[id]
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/invoice/[id]')
-rw-r--r--src/routes/(app)/invoice/[id]/+page.svelte8
-rw-r--r--src/routes/(app)/invoice/[id]/tip/+page.svelte11
2 files changed, 14 insertions, 5 deletions
diff --git a/src/routes/(app)/invoice/[id]/+page.svelte b/src/routes/(app)/invoice/[id]/+page.svelte
index 30fa3dce..a2c204d1 100644
--- a/src/routes/(app)/invoice/[id]/+page.svelte
+++ b/src/routes/(app)/invoice/[id]/+page.svelte
@@ -42,12 +42,16 @@
let { id, subject, user } = $state(data);
let { invoice, src } = $derived(data);
let { aid, amount, rate, tip, hash, text, type } = $derived(invoice);
- let { memo } = $state(invoice);
+ let memo = $state();
let { username, currency } = $derived(invoice.user);
- let locale = loc(user);
+ let locale = $derived(() => loc(user));
let tipPercent = $derived(tip ? (tip / amount) * 100 : 0);
+ $effect(() => {
+ if (typeof memo === "undefined") memo = invoice.memo;
+ });
+
// if (browser && !subbed[id])
// send("subscribe", invoice)
// .then(() => (subbed[id] = true))
diff --git a/src/routes/(app)/invoice/[id]/tip/+page.svelte b/src/routes/(app)/invoice/[id]/tip/+page.svelte
index a1ea3586..2dca611e 100644
--- a/src/routes/(app)/invoice/[id]/tip/+page.svelte
+++ b/src/routes/(app)/invoice/[id]/tip/+page.svelte
@@ -76,10 +76,10 @@
tip,
user: { username },
} = $state(invoice);
- let locale = $derived(loc(user));
+ let locale = $derived(() => loc(user));
let qr;
- let tipPercent = $state((tip / amount) * 100);
+ let tipPercent = $state();
let fullscreen;
@@ -87,6 +87,7 @@
let rate = invoice.rate * (data.rate / data.invoiceRate);
$effect(() => {
+ if (typeof tipPercent === "undefined") tipPercent = (tip / amount) * 100;
tip = Math.round((amount / 100) * untrack(() => tipPercent));
});
@@ -173,7 +174,11 @@
</div>
{/if}
- <button type="submit" bind:this={submit}></button>
+ <button
+ type="submit"
+ bind:this={submit}
+ aria-label="Submit tip"
+ ></button>
</form>
{#if showCustomAmount}